home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Fractal.h
-
- Used to build: “Fractal 8”
-
- Written by: Jim Cathey July 1985
- Eric Traut November 1994
-
- Description:
- See comments in the file “FractalMain.c” for more
- information.
- */
-
- #pragma cplusplus off
-
- #include <QDOffscreen.h>
-
- /* Menu information */
- enum {
- kMenuBarID = 128,
- kAppleMenuID = 128,
- kAboutBoxItem = 1,
- kFileMenuID = 129,
- kNewFractalItem = 1,
- kQuitItem = 3,
- kEditMenuID = 130,
- kOptionsMenuID = 131,
- kSetupItem = 1,
- kContinuousItem = 3,
- kMorphItem = 4,
- kDrawSurfaceItem = 5
- };
-
- /* Window, dialog, and alert constants */
- enum {
- kMainWindowID = 260,
- kAboutBox1DialogID = 256,
- kAboutBoxOKButtonID = 1,
- kAboutBoxMoreButtonID = 2,
- kAboutBox2DialogID = 257,
- kFatalErrorAlertID = 128
- };
-
- /* Setup dialog constants */
- enum {
- kSetUpDialogID = 258,
- kSetUpOKButtonID = 1,
- kSetUpCancelButtonID = 2,
- kSetUpLevelID = 4,
- kSetUpMtnButtonID = 5,
- kSetUpHillsButtonID = 6,
- kSetUpWaterButtonID = 7
- };
-
- /* Style and level constants */
- enum {
- kStyleMountains = kSetUpMtnButtonID,
- kStyleHills = kSetUpHillsButtonID,
- kStyleWater = kSetUpWaterButtonID,
- kMaxLevel = 7,
- kDefaultStyle = kStyleWater,
- kDefaultLevel = 6
- };
-
- enum {
- kMaxXPoint = ((1 << kMaxLevel) + 1) + 1,
- kMaxYPoint = ((1 << (kMaxLevel - 1)) + 1) + 1
- };
-
- /* Screen constants */
-
- #if 1
- enum {
- kNewScreenX = 630,
- kNewScreenY = 434,
- kScaleShift = 5,
- kScreenBoundaryBits = 5,
- kWindowTitleHeight = 16,
- kTotalGrays = 256
- };
-
- enum {
- kXOrigin = 40,
- kYOrigin = 108,
- kYMountainOrigin = 330
- };
-
- enum {
- kShadeMapSize = 256,
- kVectorBaseSize = 16
- };
- #else
- enum { // original values
- kNewScreenX = 630,
- kNewScreenY = 434,
- kScaleShift = 5,
- kScreenBoundaryBits = 5,
- kWindowTitleHeight = 16,
- kTotalGrays = 256
- };
-
- enum {
- kXOrigin = 40,
- kYOrigin = 108,
- kYMountainOrigin = 330
- };
-
- enum {
- kShadeMapSize = 256,
- kVectorBaseSize = 16
- };
- #endif
-
- /* Types used in fractal */
- struct ThreePoint {
- short x;
- short y;
- short z;
- };
- typedef struct ThreePoint ThreePoint;
-
- /* Global variables used in multiple files */
- extern short (*gOldPointArray)[kMaxXPoint][kMaxYPoint];
- /* The array of points to be subdivided. */
- extern short (*gNewPointArray)[kMaxXPoint][kMaxYPoint];
- /* The array of points to be subdivided. */
- extern ThreePoint (*gPlotPointArray)[2 * kMaxXPoint][2 * kMaxYPoint];
- /* The array of points to be subdivided */
- extern short gContourType; /* Contour type */
- extern short gContourLevel; /* Level of detail */
- extern short gMainWindowHeight; /* Height of main window */
- extern short gMainWindowWidth; /* Width of main window */
- extern long gMicrosecondCount; /* Total time spent calculating and drawing */
- extern long gTotalFractals; /* Total fractal count */
- extern Boolean gFractalChanged; /* Should this screen update be counted? */
- extern GWorldPtr gOffscreenGWorld; /* GWorld for faster drawing */
- extern PixMapHandle gOffscreenPixMap; /* Offscreen PixMap */
- extern WindowPtr gMainWindow; /* Our one window */
- extern float gMorphAmount; /* Percent of morph complete */
- extern float gMorphAmountNeg;
- extern Boolean gContinuousRedraw; /* Continuously redraw fractal */
- extern Boolean gMorphFractal; /* Morph or not morph */
- extern unsigned short gShadeMap[kShadeMapSize];
-
- void CalcSurface(unsigned short level);
- void PlotData(Boolean plotSurface);
- void SetBlitBuffer(unsigned char *blitData, Rect *blitBounds, short blitRowBytes);
- void FillTriangle(long vertex1H, long vertex1V, long vertex2H, long vertex2V, long vertex3H, long vertex3V, unsigned char color);
-
-
-